package com.ruoyi.system.utils;

import java.math.BigDecimal;

public class BigDecimalUtils {

    public static void main(String[] args) {
        BigDecimal amount1 = null;
        BigDecimal amount2 = BigDecimal.ZERO;
        BigDecimal amount3 = new BigDecimal("0.00");
        BigDecimal amount4 = new BigDecimal("100.50");

        System.out.println("amount1 is empty: " + isEmpty(amount1)); // true
        System.out.println("amount2 is empty: " + isEmpty(amount2)); // true
        System.out.println("amount3 is empty: " + isEmpty(amount3)); // true
        System.out.println("amount4 is empty: " + isEmpty(amount4)); // false
    }

    public static boolean isEmpty(BigDecimal value) {
        return value == null || value.compareTo(BigDecimal.ZERO) == 0;
    }

    public static boolean isNotEmpty(BigDecimal value) {
        return !isEmpty(value);
    }
}
